1. Field of the Invention
The present invention relates to a communication control apparatus for performing two-way communication processing with a data processing apparatus via a predetermined interface, a method for processing data of the communication control apparatus, and a storage medium storing programs capable of being read by a computer.
2. Description of the Related Art
Conventionally, data communication between a host apparatus and an image input/output apparatus, such as a printer, a scanner or the like, is executed via a predetermined interface. A Centronics interface, serving as an interface of this type, is a main interface for transferring data from a host computer to a printer, and has the feature that inexpensive high-speed data transfer can be performed with standards for transmitting data from a computer to a printer which have been developed by Centronics Corporation of U.S.A. for its own printers. Although the Centronics interface is widely used as means for transmitting data from a personal computer (PC) to a printer, it is not standardized.
Although the Centronics interface has many variations depending on each combination of a host computer and a printer, the variations are basically similar. Basic controls are performed using three signal lines, i.e., DATA STROBE, ACK and BUSY. A transfer method using these three signal lines is called a compatibility mode in contrast to a nibble mode, a byte mode, an ECP (extended capabilities port) mode and the like (to be described later).
The compatibility mode will now be described in detail with reference to drawings. It is impossible to describe all of many variations which exist in the compatibility mode as described above. Hence, a description will be provided illustrating a laser-beam printer made by Canon Inc.
FIG. 22 is a plan view illustrating the pin arrangement of a printer interface in a printing system to which a communication control apparatus of this type can be applied. In FIG. 22, 36 pins are arranged.
Numerals in FIG. 22 represent the numbers of respective pins, each of which corresponds to one signal line. In FIG. 22, a pin 1 is a signal line for DATA STROBE, and usually assumes a xe2x80x9cHighxe2x80x9d state. When the state shifts to a xe2x80x9cLowxe2x80x9d state, a printer reads the states of pins 2-9 for data lines DATA1-DATA8, respectively.
The data lines DATA1-DATA8 represent information for the 0th-7th bits, respectively, of data transmitted from a host apparatus. On each of these data lines, data is xe2x80x9c1xe2x80x9d and xe2x80x9c0xe2x80x9d in the xe2x80x9cHighxe2x80x9d and xe2x80x9cLowxe2x80x9d states, respectively. In a stationary state, data is indefinite. Data is effective only when the DATA STROBE line assumes the xe2x80x9cLowxe2x80x9d state.
A pin 10 is for an acknowledge line ACK, and assumes the xe2x80x9cHighxe2x80x9d state in a stationary state. A pulse for providing the xe2x80x9cLowxe2x80x9d state is generated when the state shifts from the stationary state.
A pin 11 is for a busy line BUSY, on which a state signal indicating whether or not the printer can receive data from the host apparatus is provided. On this line, the xe2x80x9cLowxe2x80x9d state represents a state in which a signal can be received, and the xe2x80x9cHighxe2x80x9d state represents a state in which a signal cannot be received.
A pin 12 is for a printer error line PE, which assumes the xe2x80x9cHighxe2x80x9d state when an error is generated in the printer, and assumes the xe2x80x9cLowxe2x80x9d state in other states. A pin 13 is for a select line SELECT, which assumes the xe2x80x9cHighxe2x80x9d state when the printer is in an on-line state, and assumes the xe2x80x9cLowxe2x80x9d state in other states. A pin 14 is for a signal line AUTO FD, which is unused.
A pin 15 is for a signal line AUXOUT1, which always assumes the xe2x80x9cHighxe2x80x9d state. The ground level of the printer is applied to a pin 16. A pin 17 is for a frame ground line Frame GND, which corresponds to the frame ground of the printer.
A voltage of +5 V is applied to a pin 18, which always assumes the xe2x80x9cHighxe2x80x9d state. Pins 19-30 are connected to the ground. A pin 31 is for an input prime line INIT, which always assumes the xe2x80x9cHighxe2x80x9d state. By making the input prime line INIT to the xe2x80x9cLowxe2x80x9d state, input prime processing is performed.
A pin 32 is for a signal line FAULT, which assumes the xe2x80x9cHighxe2x80x9d state when the printer is in an on-line state, and assumes the xe2x80x9cLowxe2x80x9d state in other states. A pin 33 is for a signal line AUXOUT2, which always assumes the xe2x80x9cLowxe2x80x9d state. A pin 34 is for a signal line AUXOUT3, which always assumes the xe2x80x9cLowxe2x80x9d state. A pin 35 is for a signal line AUXOUT4, which always assumes the xe2x80x9cHighxe2x80x9d state. A pin 36 is for a signal line SELECTIN, which is unused.
In the compatibility mode, the pins 1-11 for DATA STROBE, DATA1, DATA2, DATA3, DATA4, DATA5, DATA6, DATA7, DATA8, ACK and BUSY, respectively, are mainly used. FIG. 23 illustrates handshaking in the compatibility mode.
FIG. 23 illustrates a timing chart for explaining the state of data transfer processing in the printing system. The timing chart shown in FIG. 23 corresponds to handshaking in the compatibility mode. In this case, 1-byte data is transmitted.
The compatibility mode can only perform data transfer in one direction from the host apparatus to the printer, and cannot perform data transfer from the printer to the host apparatus.
In order to solve this problem, two-way Centronics communication handshaking is standardized by the IEEE (Institute of Electrical and Electronics Engineers) as a superior alternative of the compatibility mode (IEEE 1284-1994).
In the IEEE 1284-1994, a plurality of communication modes, such as the nibble mode, the byte mode, the ECP mode and the like, are newly provided in addition to the above-described compatibility mode (the conventional handshaking for transferring data from a host apparatus to a printer).
Connectors and cables having the same shape as in the compatibility mode can be used in all of the newly added modes. The nibble mode is for transferring data from a printer to a host apparatus. By alternately using the nibble mode and the compatibility mode, two-way communication between a host apparatus and a printer can be realized.
That is, by performing transmission from a host apparatus to a printer in the compatibility mode and performing transmission from the printer to the host apparatus in the nibble mode, two-way communication can be realized.
In the nibble mode, control is performed using the acknowledge signal line ACK and the signal line AUTO FD, and data is set on the four signal lines, i.e., BUSY, PE, SELECT and FAULT.
8-bit (1-byte) transfer is realized by dividing 1 byte of data into two 4-bit portions, and first transmitting lower-order 4 bits followed by transmission of higher-order 4 bits. The signal line FAULT is also used for indicating by the printer whether or not data to be transmitted to the host apparatus is ready at a specific timing. Handshaking is performed without using the signal lines DATA1, DATA2, . . . , DATA8 which are controlled only by the host apparatus in the compatibility mode. These signal lines DATA1, DATA2, . . . , DATA8 are called data buses. Since the data buses are not used in the nibble mode, the host apparatus side need not provide hardware for dealing with data transmitted through the data buses. Hence, mounting can be relatively easily realized.
The byte mode is also for performing communication from a printer to a host apparatus, as the nibble mode. By alternately using the compatibility mode and the byte mode, two-way communication between the host apparatus and the printer can be realized.
That is, by performing transmission from the host apparatus to the printer in the compatibility mode, and performing transmission from the printer to the host apparatus in the byte mode, two-way communication can be realized. In the byte mode, control is performed using the signal lines STROBE, ACK, BUSY, PE, AUTO FD and FAULT, and data is set on the data buses (the signal lines DATA1, DATA2, . . . , DATA 8). This mode is more efficient than the nibble mode because 1-byte (8-bit) data is simultaneously transmitted. However, since the data buses are controlled by the printer side, the host apparatus side must provide hardware for dealing with transmitted data.
The ECP mode is for performing two-way communication between a host apparatus and a printer, and vice versa. By performing switching between Forward Phase (from the host apparatus to the printer) and Reverse Phase (from the printer to the host apparatus), two-way data communication can be realized in the same ECP mode.
In the ECP mode, control is performed using the signal lines STROBE, ACK, BUSY, AUTO FD, INIT, FAULT and PE, and data is set on the data buses.
In this case, since the data buses are also controlled by the printer side, the host apparatus side must provide hardware for dealing with transmitted data. The ECP mode has the features that overhead for shifting between the modes is small, and a higher transfer speed can be provided in handshaking for transfer in the Forward Phase than in handshaking in the compatibility mode. The outline of the IEEE 1284 has been described.
Data transmitted from the host apparatus to the printer via the Centronics interface is interpreted only by an interpretation portion of the printer side, and the printer performs printing processing in accordance with the result of interpretation. During transmission of a series of data, it is impossible to transmit other data, control commands and the like until the transmission of the series of data is completed.
That is, since a command for asking the state of the printer cannot be transmitted to the printer until the transmission of a series of data is completed even if the host apparatus side intends to know the state of the printer during the transmission, the host apparatus side cannot know the state of the printer.
In order to solve such a problem which will occur when using an I/F (interface) having only a single data path as the Centronics interface, it is now intended to standardize packet protocols.
For example, IEEE 1284.4 is one of packet protocol standards. The IEEE 1284.4 assumes various serial or parallel I/Fs, such as RS232C, USB (Universal Serial Bus), IEEE1394 and the like, in addition to the IEEE 1284.4 as physical I/Fs. An outline of the IEEE 1284.4 will be described later.
The packet protocol is a protocol in which, for example, a series of data is divided into a plurality of blocks, and the data is provided in the form of a packet by adding a header indicating packet information, such as the data size, channel IDs and the like, to the head of each block, so as to logically realize a plurality of channels and allow independent information exchange without causing interference between the channels.
By using such a packet protocol, it is logically possible to exchange a plurality of independent information (data, control commands and the like) in parallel on different channels. For example, it is possible to transmit a command asking the state of the printer during transmission of a series of data without awaiting the completion of the transmission.
By preparing a reception buffer storage for each channel, even if the reception buffer storage in a certain channel is fully occupied, other channels can be used without being influenced by that channel.
For example, when it is intended to transmit 20-Kbyte (kilobyte, hereinafter abbreviated as xe2x80x9cKBxe2x80x9d (1 KB=1024 bytes)) data as printing data and 100-byte (hereinafter abbreviated as xe2x80x9cBxe2x80x9d) data as a control command, a protocol other than a packet protocol can select only one of two methods, i.e., a method of first completing the transmission of the 20-KB printing data followed by the transmission of the 100-B control command, and a method of first completing the transmission of the 100-B control command followed by the transmission of the 20-KB printing data.
To the contrary, in a packet protocol, it is possible to transmit a control command during transmission of printing data. For example, the 20-KB printing data is divided into 10 blocks, and the 100-B control command is transmitted after completing transmission of a 2-KB block and before transmitting the next 2-KB block. Hence, a packet protocol is useful, for example, in real-time control of a printer by a host apparatus.
An outline of the IEEE 1284.4, an example of division of data into packets, and an example of transmission of printing data and a control command will now be described.
It can be said that the IEEE 1284.4 mainly provides two features, i.e., flow control between two apparatuses (for example, a host apparatus and a printing apparatus) utilizing a concept of credit and using data transfer conforming to the above-described IEEE 1284 standards (or any other appropriate interface), and multiplexing (provision of multichannels) for simultaneously exchanging a plurality of information (for example, data and control information).
In internal processing in the host apparatus and the printing apparatus, control by the IEEE 1284.4 is performed in an intermediate portion between processing of performing printing using transferred data (generally called xe2x80x9capplicationxe2x80x9d) and the IEEE 1284, serving as actual data transfer portion. FIG. 24 illustrates the concept of such relationship.
FIG. 24 is a diagram illustrating the concept of relationship between each communication control program and application in the printing system.
As shown in FIG. 24, a control program according to the IEEE 1284.4 is present between the host apparatus and the printing apparatus which can communicate with each other via an interface cable, so as to perform communication between application and a control program according to the IEEE 1284.
Next, the configuration of data dealt with in the IEEE 1284.4 will be described. Data dealt with in the IEEE 1284.4 is always formed in units of a group comprising some bytes, which is called a packet. The configuration of the packet is defined as shown in FIG. 25.
FIG. 25 is a diagram illustrating the configuration of a communication packet utilized in a communication interface of the printing system.
In FIG. 25, the communication packet is configured by a header portion H comprising 6 bytes, and data Data provided thereafter.
The header portion H will now be described in more detail.
The first byte represents Primary Socket ID (hereinafter abbreviated as xe2x80x9cPSIDxe2x80x9d), which represents Socket ID of an apparatus where initialization of control according to the IEEE 1284.4 (to be described later) is started. The Socket ID will be described later.
The second byte represents Secondary Socket ID (hereinafter abbreviated as xe2x80x9cSSIDxe2x80x9d), which represents Socket ID of another apparatus with respect to the above-described apparatus.
The third and fourth bytes represent the size of the entire packet inclusive of the 6-byte header. For example, in the case of a packet including 10-byte data, a value 16 (6 bytes for the header and 10 bytes for the data) is recorded in this portion. FIGS. 26A and 26B illustrate data which is provided in the form of a packet, and data which is not provided in the form of a packet, respectively.
FIGS. 26A and 26B are diagrams, each illustrating communication data exchanged through a communication interface of the printing system: FIG. 26A illustrates data which is provided in the form of a packet; and FIG. 26B illustrates data which is not provided in the form of a packet.
In the case of FIG. 25, for a packet having 0-byte data, a value 6 which represents 6 bytes for only the header portion is recorded in the portion of the third and fourth bytes.
Actually, however, since each data is represented by hexadecimal notation, the above-described 16 and 6 are represented by 0x0010 and 0x0006, respectively (in the case of hexadecimal notation, the notation generally starts with xe2x80x9c0xxe2x80x9d, and 1 byte is represented by two digits).
The fifth byte represents Credit (to be described later). The sixth byte represents control data described as Control. One bit in this byte (one byte comprises eight bits) represents whether or not the packet is an ordinary packet (which is represented by xe2x80x9c0xe2x80x9d). Since the packet is an ordinary packet in most cases, the bit is 0. The remaining seven bits are used as a reserved region which is not used at present (represented by 0).
Accordingly, this byte is usually represented by xe2x80x9c0x00xe2x80x9d. The data portion includes transfer data formed by application of each of the host apparatus and the printing apparatus (printing data and control data), or a control command in the IEEE 1284.4 (to be described later).
Next, the Socket ID shown in FIG. 25 will be described.
When a plurality of processing (mainly the processing of the application portion) in two apparatuses connected by a single interface (for example, an IEEE 1284 interface) identify respective partners thereof (processing in another apparatus) and exchange data independently, an individual number provided for each processing within each apparatus for executing the data exchange is represented by Socket ID. An outline of the Socket ID will now be described.
For example, when two types of processing (processing A and processing B) are present in the application of the host apparatus, and two types of processing (processing xe2x80x9caxe2x80x9d for the processing A and processing xe2x80x9cbxe2x80x9d for the processing B) are present in the application of the printing apparatus, it is assumed that the PSIDs for the processing A and the processing B are 0x10 and 0x20, and the SSIDs for the processing xe2x80x9caxe2x80x9d and the processing xe2x80x9cbxe2x80x9d are 0x10 and 0x20, respectively. By making the PSID and the SSID of the packet 0x10 and 0x10, respectively, when the processing A transmits data xe2x80x9cAxe2x80x9d and xe2x80x9cIxe2x80x9d, and making the PSID and the SSID of the packet 0x20 and 0x20, respectively, when the processing B transmits data xe2x80x9cKAxe2x80x9d and xe2x80x9cKIxe2x80x9d, according to the control of the IEEE 1284.4, it is possible to recognize from which processing to which processing the transmitted packet is transferred, and therefore to assuredly transfer the data to corresponding processing. Hence, it can be said that a plurality of channels have been logically used so as to realize a multichannel operation.
FIGS. 27-31 are diagrams illustrating the concept of a multichannel operation in a communication interface in the printing system, and sequentially illustrate a manner in which data are independently transferred from a plurality of (two in this case) application of the host apparatus to a plurality (two in this case) of corresponding application in the printing apparatus via respective processing.
Particularly, in FIG. 27, two types of processing (the processing A and the processing B) are present in the application of the host apparatus, and each processing has data to be transferred (xe2x80x9cAxe2x80x9d and xe2x80x9cIxe2x80x9d for the processing A, and xe2x80x9cKAxe2x80x9d and xe2x80x9cKIxe2x80x9d for the processing B).
FIG. 28 illustrates a manner in which packets are formed in the IEEE 1284.4 processing in the host apparatus, and the above-described Socket IDs are provided for each of the packets. The procedure for transferring the packets will be described later.
FIG. 29 illustrates a manner in which each data in the form of a packet is transferred from the host apparatus to the printing apparatus via the processing of the interface (IEEE 1284 processing). As shown in FIG. 29, the order of transfer of the packets is not particularly defined. In the case of FIG. 29, four packets are transferred in the order of the first packet of the processing A (the packet having the data xe2x80x9cAxe2x80x9d), the first packet of the processing B (the packet having the data xe2x80x9cKAxe2x80x9d), the second packet of the processing A (the packet having the data xe2x80x9cIxe2x80x9d), and the second packet of the processing B (the packet having the data xe2x80x9cKIxe2x80x9d).
FIG. 30 illustrates a manner in which the packets transferred to the printing apparatus are received by the IEEE 1284.4 at the printing apparatus side, and data extracted from each packet is transferred to corresponding application in accordance with the Socket IDs. As a result, as shown in FIG. 31, each data is transferred to the processing of corresponding application (the processing xe2x80x9caxe2x80x9d and the processing xe2x80x9cbxe2x80x9d) within the printing apparatus. A similar operation is, of course, performed for transfer in a direction reverse to the above-described case (from the processing in the printing apparatus to the processing in the host apparatus).
When Socket IDs are represented by 0x00 (i.e., both PSID and SSID are represented by 0x00), only Command and Reply Packet (to be described later) necessary for executing the IEEE 1284.4 processing are transferred.
Next, the procedure (the flow of processing) of basic control in the IEEE 1284.4 will be described with reference to the flowcharts shown in FIGS. 32-34, and examples of packets shown in FIGS. 35 and 36.
FIGS. 32-34 are flowcharts illustrating a data communication processing procedure in the printing system. In FIGS. 32-34, numerals (1)-(24) represent respective steps.
First, an apparatus intending to start control according to the IEEE 1284.4 provides another apparatus with an initial command packet Init Command Packet (step (1)) (since a host apparatus usually provides a printing apparatus with such a packet, the apparatus which has provided the packet Init Command Packet is called the host apparatus, and another apparatus is called the printing apparatus).
The structure of the packet Init Command Packet will now be described with reference to FIG. 35.
FIG. 35 is a diagram illustrating the data structure of an initial command packet notified from the upper apparatus to the apparatus of the communication partner (the printing apparatus) in the printing system. The packet Init Command Packet includes the first through eighth bytes, and a header portion includes the first through sixth bytes.
In FIG. 35, data in portions other than a portion Credit in the fifth byte are substantially fixed data.
The printing apparatus which has received the packet Init Command Packet determines if control according to the IEEE 1284.4 can be started (step (2)). If the result of the determination in step (2) is affirmative, a reply packet Init Reply Packet indicating the possibility of starting the control is formed (step (3)). If the result of the determination in step (2) is negative, a reply packet Init Reply Packet indicating the incapability of starting the control is formed (step (4)), and the process proceeds to step (5). At that time, if control according to the IEEE 1284.4 can be started, initialization for the start is also executed.
In step (5), the initial reply packet Init Reply Packet is transferred to the host apparatus. The data structure of the packet Init Reply Packet will now be briefly described with reference to FIG. 36.
FIG. 36 is a diagram illustrating the data structure of a reply packet notified from the printing apparatus to the host apparatus requesting communication in the printing system. The packet Init Reply Packet includes the first through ninth bytes, and a header portion includes the first through sixth bytes.
In FIG. 36, the eighth byte represents data Result. The reply packet Init Reply Packet notifies the host apparatus whether processing according to the IEEE 1284.4 can be normally started or the processing cannot be started because of some reason.
Then, the host apparatus determines if the processing according to the IEEE 1284.4 can be started, i.e., if data processing is to be normally continued, in accordance with the notified packet Init Reply Packet (step (6)). If the result of the determination in step (6) is affirmative, the host apparatus then provides the printer with a command packet Open Channel Command Packet having a data structure as shown in FIG. 37.
If the result of the determination in step (6) is negative, the packet Init Command Packet is again transferred to the printing apparatus, or control according to the IEEE 1284.4 is given up.
The data structure of the packet Open Channel Command Packet will now be briefly described with reference to FIG. 37.
FIG. 37 is a diagram illustrating the data structure of a packet Open Channel Command Packet notified from the host apparatus to the printing apparatus in the printing system. The packet Open Channel Command Packet includes the first through seventeenth bytes, and a header portion includes the first through sixth bytes.
In FIG. 37, the ninth byte represents a parameter, which corresponds to Secondary Socket ID. The tenth and eleventh bytes also represent a parameter Primary To Secondary Packet Size indicating the maximum size of a packet transferred from the host apparatus to the printing apparatus according to a request of the host apparatus. The twelfth and thirteenth bytes represent a parameter Secondary To Primary Packet Size indicating the maximum size of a packet transferred from the printing apparatus to the host apparatus according to a request of the host apparatus.
The fourteenth and fifteenth bytes represent a parameter which corresponds to information Credit Requested requested by the host apparatus. The sixteenth and seventeenth bytes represent a parameter which corresponds to information Maximum Outstanding Credit.
When the printing apparatus has received the packet Open Channel Command Packet, the printing apparatus confirms if the value of the parameter Secondary Socket ID in the received packet equals the value of the SSID possessed by the printing apparatus (step (8)). If the received SSID is confirmed to be the SSID possessed by the printing apparatus, the channel is established (opened).
It is possible to identify the opened channel based on the combination of Socket IDs (PSID and SSID). That is, as described above with respect to the Socket IDs, the channel connecting the processing A of the application in the host apparatus to the processing xe2x80x9caxe2x80x9d of the application in the printing apparatus can be identified based on the combination of the Socket IDs (PSID=0X10 and SSID=0x10). Similarly, the channel connecting the processing B of the application in the host apparatus to the processing xe2x80x9cbxe2x80x9d of the application in the printing apparatus can be identified based on the combination of the Socket IDs (PSID=0X20 and SSID=0x20).
Then, the parameter Primary To Secondary Packet Size indicating the maximum size of the packet when transferring data from the host apparatus to the printing apparatus according to a request of the host apparatus, and the parameter Secondary To Primary Packet Size indicating the maximum size of the packet when transferring data from the printing apparatus to the host apparatus according to a request of the host apparatus are checked, in order to determine if the checked size is a packet size which can be prepared by the corresponding apparatus (step (9)). If the result of the determination in step (9) is affirmative, a parameter indicating the fact is set in a packet Open Channel Reply Packet (to be described later). If the result of the determination in step (9) is negative, the packet sizes (Primary To Secondary Packet Size and Secondary To Primary Packet Size) which can be prepared by the respective apparatuses are set as the parameters.
Then, a parameter Credit Requested and a parameter Maximum Outstanding Credit representing information Credit requested by the host apparatus are analyzed (step (10)), and a reply for a request represented by the combination of the two parameters is performed using a parameter Open Channel Reply as in the above-described case of the packet size.
When the analysis of respective parameters Open Channel Command has been completed in the above-described manner, the printing apparatus forms a packet Open Channel Reply Packet shown in FIG. 38 (step (11)) and transfers the formed packet to the host apparatus (step (12)).
FIG. 38 is a diagram illustrating the data structure of the packet Open Channel Reply Packet notified from the printing apparatus to the host apparatus in the printing system. The packet Open Channel Reply Packet includes the first through sixteenth bytes, and a header portion includes the first through sixth bytes.
In FIG. 38, the eleventh and twelfth bytes represent a parameter Primary To Secondary Packet Size indicating the maximum size of the packet transferred from the host apparatus to the printing apparatus according to a request of the host apparatus.
The thirteenth and fourteenth bytes represent a parameter Secondary To Primary Packet Size indicating the maximum size of the packet transferred from the printing apparatus to the host apparatus according to a request of the host apparatus.
Then, the host apparatus determines if the channel has been opened by analyzing the parameter Open Channel Reply Packet (step (13)). If the result of the determination in step (13) is affirmative, the data packet having the data structure shown in FIG. 25 can be transferred to the opened channel (step (14)).
The size of the data packet to be transferred is determined by comparing the packet size requested by the user (the host apparatus which has provided the packet Open Channel Command Packet) with the packet size requested by the printing apparatus side and indicated by the reply Open Channel Reply, and adopting the smaller packet size.
The transfer of the data packet in the reverse direction (i.e., from the printing apparatus to the host apparatus) may, of course, be performed, and the transfer of the packet Command Packet relating to Credit (to be described later) becomes effective in this case (the transfer may, of course, be performed before opening the channel, though such transfer is meaningless).
Any number of channels may be opened provided that processing can be performed within the apparatus (and combination of Socket IDs does not overlap), by repeating the return to step (7). In the above-described example of Socket IDs, two channels, i.e., the channel connecting the processing A of the host apparatus to the processing xe2x80x9caxe2x80x9d of the printing apparatus, and the channel connecting the processing B to the processing xe2x80x9cbxe2x80x9d, are opened.
The flow until the channel connecting the processing of application within the host apparatus to the processing of application within the printing apparatus is opened has been described. Since a channel for transferring various commands Command and replies Reply (Init. Open Channel and the like) (hereinafter termed a xe2x80x9ccommand channelxe2x80x9d) has been implicitly opened, the above-described procedure is unnecessary.
As has been described, the Socket ID for identifying the channel is xe2x80x9c0x00xe2x80x9d. It is possible to terminate (close) a channel where data exchange has been terminated (which is to be terminated) by a packet Close Channel Command Packet.
When the host apparatus intends to close a channel, a packet Close Channel Command Packet having the data structure shown in FIG. 39 is transferred to the printing apparatus (step (15)).
FIG. 39 is a diagram illustrating the data structure of a packet Close Channel Command Packet notified from the host apparatus to the printing apparatus in the printing system. The packet Close Channel Command Packet includes the first through ninth bytes, and a header portion includes the first through sixth bytes.
In FIG. 39, the eighth and ninth bytes represent a parameter which is obtained by combining Primary Socket ID and Secondary Socket ID for indicating the channel to be closed.
The printing apparatus analyzes the parameter (step (16)), and determines if the channel assigned to be closed is closable (opened) (step (17)). If the result of the determination in step (16) is affirmative, the printing apparatus closes the channel, and prepares a reply for notifying the host apparatus of the fact using a packet Close Channel Reply Packet (step (18)).
If the result of the determination in step (17) is negative, a packet Reply Packet is formed (step (19)).
After thus forming the packet Close Channel Reply Packet, the printing apparatus transfers the formed packet Close Channel Reply Packet having the data structure shown in FIG. 40 to the host apparatus (step (20)).
FIG. 40 is a diagram illustrating the data structure of the packet Close Channel Reply Packet notified from the printing apparatus to the host apparatus in the printing system. The packet Close Channel Reply Packet includes the first through tenth bytes, and a header portion includes the first through sixth bytes.
In FIG. 40, a parameter Result is set in the eighth byte. The ninth and tenth bytes represent a parameter including Primary Socket ID and Secondary Socket ID.
The host apparatus confirms that the channel is closed by receiving the packet Close Channel Reply Packet and analyzing the above-described parameter Result (step (21)).
After the channel has been closed, there is no problem to again open the channel by a packet Open Channel Command Packet if necessary (return to step (7)), or the control according to the IEEE 1284.4 may be terminated in that state.
In this case, the host apparatus provides a packet Exit Command Packet having the data structure shown in FIG. 41 and transfers this packet to the printing apparatus (step (22)).
FIG. 41 is a diagram illustrating the data structure of the packet Exit Command Packet notified from the host apparatus to the printing apparatus in the printing system. The packet Exit Command Packet includes the first through seventh bytes, and a header portion includes the first through sixth bytes.
In FIG. 41, a command Exit, Command is set in the seventh byte.
When the printing apparatus has received the packet Exit Command Packet, the printing apparatus terminates the processing according to the IEEE 1284.4 (data exchange on the opened channel, and the like) (step (23)), and then forms a reply packet Exit Reply Packet having the data structure shown in FIG. 42 and transfers the formed packet to the host apparatus (step (24)).
FIG. 42 is a diagram illustrating the data structure of the packet Exit Reply Packet notified from the printing apparatus to the host apparatus in the printing system. The packet Exit Reply Packet includes the first through eighth bytes, and a header portion includes the first through sixth bytes.
In FIG. 42, a command Command is set in the seventh byte, and a result Result is set in the eighth byte.
The control according to the IEEE 1284.4 is thereby terminated, and the data transfer by the packet (conforming to the IEEE 1284.4) is also terminated.
When resuming the control according to the IEEE 1284.4, it is necessary to execute the control from processing of transferring the packet Init Command Packet. The command packet Exit Command Packet may, of course, be provided at any time while the control according to the IEEE 1284.4 is executed, as any other command packet Command Packet.
By executing the process until step (14) of the above-described flowcharts in order to open the channel, the transfer of the data packet can be started. However, the control is performed so that, when transferring the data packet, the transfer cannot be started unless acknowledging data Credit is not received from the processing of the apparatus where the data packet is to be transferred.
Thus, the IEEE 1284.4 realizes flow control of data (packet) (as for the Socket ID, when the processing A at the host apparatus side transfers the packet to the processing xe2x80x9caxe2x80x9d at the printing apparatus side, the processing A cannot process the packet unless a parameter Credit is not received from the processing xe2x80x9caxe2x80x9d). When storing data transferred from the communication partner in resources (storage means, capable of reading and writing data, which is generally called a buffer storage or the like, and which is hereinafter termed a reception buffer storage assuming the printing apparatus) possessed by the user, the processing will not be normally operated by missing transferred data, unless control is performed so as not to receive data to an amount exceeding the capacity of the reception buffer storage. The flow control adjusts interruption and resumption of data transfer in order to prevent such a situation.
Next, a description will be provided of the concept of the parameter Credit used in the flow control of packet transfer in the IEEE 1284.4.
The parameter Credit is provided from the packet receiving side to the packet transmitting side in order to indicate to what extent the receiving side is ready to receive the packet. The packet receiving side guarantees that the packet provided as the parameter Credit can be assuredly received.
For the exchange of the parameter Credit, an acknowledgment command packet Credit Command Packet and an acknowledgment request command packet Credit Request Command Packet and a packet Reply Packet corresponding to these packets are mainly used. However, the parameter Credit may also be provided by a packet Data Packet or Open Packet, except for a command channel which already has two parameters Credit at initialization, in order to allow execution of Init or Error processing according to the IEEE 1284.4 in any case.
Next, state transition of a simple parameter Credit will be described with reference to FIG. 43.
FIG. 43 is a diagram illustrating state transition of the parameter Credit between the host apparatus and the printing apparatus in the printing system.
In an initial state in which power is supplied to the apparatuses (the host apparatus and the printing apparatus), the parameter Credit on the internal command channel is set to xe2x80x9c2xe2x80x9d, and the parameter Credit on the channel (which is not yet opened at this stage) for transferring data (a packet) is, of course, set to xe2x80x9c0xe2x80x9d.
In this example, only one channel for transferring data is shown. When a plurality of channels are opened, the control of the parameter Credit is performed for each channel.
When the host apparatus intends to start control according to the IEEE 1284.4 using an initial command packet Init Command Packet, the parameter Credit on the command channel at the host apparatus side is decremented by one to assume xe2x80x9c1xe2x80x9d according to the provision of the packet Init Command Packet. At the same time, at the printing apparatus side, when the packet Init Command Packet has been received, the acknowledgment Credit on the command channel is incremented by one to assume xe2x80x9c3xe2x80x9d. This is because it is promised that xe2x80x9c1xe2x80x9d is always present in the parameter Credit (the fifth byte of the header portion) of the packet transferred on the command channel. If the parameter Credit assumes xe2x80x9c0xe2x80x9d on the command channel and therefore the packet cannot be transferred, the succeeding processing cannot be performed. The above-described promise is provided in order to prevent such a case.
By transmitting a reply packet Init Reply Packet in response to the packet Init Command Packet from the printing apparatus, the parameter Credit on the command channel of the printing apparatus is decremented by one to assume xe2x80x9c2xe2x80x9d, and the parameter Credit on the command channel of the host apparatus is incremented by one to return to xe2x80x9c2xe2x80x9d.
When the host apparatus intends to open a data channel according to the packet Open Channel Command Packet, and the printing apparatus normally transmits a reply Open Channel Reply in response to this operation, by providing the host apparatus with two parameters Credit using the parameter Credit (the fifteenth and sixteenth bytes) in the packet Open Channel Reply Packet, the parameter Credit on the channel for transferring data at the host apparatus side is incremented by two to assume xe2x80x9c2xe2x80x9d.
Since the host apparatus has been able to open the channel for transferring data and has received the parameter Credit for this channel from the printing apparatus, it becomes possible to transfer a packet Data Packet. Hence, the host apparatus transfers two consecutive packets Data Packet. For the second packet Data Packet, a parameter Credit on the channel for transferring data to the printing apparatus is provided using the parameter Credit (the fourth byte) of the packet Data Packet. At that time, the parameter Credit on the channel for transferring data in the printing apparatus is incremented by one to assume xe2x80x9c1xe2x80x9d.
The parameter Credit on the command channel remains xe2x80x9c2xe2x80x9d because a packet Command Packet is not transferred (the printing apparatus does not transfer a packet Command Packet either). At that time, the printing apparatus can also transfer a packet Data Packet to the host apparatus.
The host apparatus has transferred two consecutive packets Data Packet and therefore used up parameters Credit on the channel for transferring data possessed by the host apparatus. Hence, in order to transfer the next packet Data Packet, the host apparatus requests a parameter Credit from the printing apparatus using a packet Credit Request Command Packet having the data structure shown in FIG. 44.
FIG. 44 is a diagram illustrating the data structure of the packet Credit Request Command Packet for requesting a parameter Credit in the printing system. This packet includes the first through thirteenth bytes, and a header portion includes the first through sixth bytes.
In FIG. 44, a parameter request Credit Requested is set in the tenth and eleventh bytes.
The printing apparatus to which a parameter Credit has been requested by the packet Credit Request Command Packet analyzes the contents of the request (from the parameter), and transfers a reply Reply corresponding to the request. In this case, it is assumed that only one parameter Credit can be provided for the host apparatus. The provided parameter Credit is entered in the parameter Credit (the eleventh and twelfth bytes) of the reply Credit Request Reply, and is transferred to the host apparatus by a packet Credit Request Reply Packet having the data structure shown in FIG. 45.
FIG. 45 is a diagram illustrating the data structure of the packet Credit Request Reply Packet in the printing system. This packet includes the first through twelfth bytes, and a header portion includes the first through sixth bytes.
In FIG. 44, the parameter Credit is set in the eleventh and twelfth bytes.
By thus receiving the packet Credit Request Reply Packet, the parameter Credit on the channel for data transfer of the host apparatus is incremented by one to assume xe2x80x9c1xe2x80x9d, so that it is possible to again transfer a packet Data Packet.
Since a parameter Credit for data transfer has been provided from the host apparatus, the printing apparatus can also transfer one packet Data Packet.
As shown in FIG. 43, if the printing apparatus transfers one packet Data Packet, the parameter Credit possessed by the printing apparatus is decremented by one to assume xe2x80x9c0xe2x80x9d. It is, of course, possible to provide the host apparatus with a parameter Credit using the parameter Credit in this packet Data Packet. The number of parameters Credit possessed by the host apparatus increases by the provided parameter Credit.
In FIG. 43, the parameter Credit for data transfer is incremented by one to assume xe2x80x9c2xe2x80x9d.
An outline of the IEEE 1284.4 has been described.
However, since conventional nonpacket protocols are also used in addition to packet protocols in the current Centronics I/Fs, a packet protocol is used in certain data transfer, and data is transferred according to a conventional nonpacket protocol without using a packet protocol in another data transfer.
In such a case, if data transferred using a packet protocol is interpreted with a nonpacket protocol, a header portion is considered to be data, so that unnecessary extra data is received,
On the other hand, if data transferred using a nonpacket protocol is interpreted with a packet protocol, an ordinary data portion is considered to be a packet header, so that a part of data of the packet is not given to the translater, thereby causing various problems.
A single printer is often shared by a plurality of host apparatuses. In such a case, a certain host apparatus may transmit data using a packet protocol, and another host apparatus may transfer data using a conventional nonpacket protocol, so that the printer cannot determine whether or not a packet protocol is to be used.
From the structure of a packet protocol, it is difficult to shift to a nonpacket protocol when the packet protocol has been used, and vice versa.
The present invention has been made in consideration of the above-described problems.
It is an object of the present invention to provide a communication control apparatus, a communication control method and a storage medium storing a communication control program in which, when packet data has been received from a data processing apparatus, the packet data is stored in a first area or a second area of a memory in accordance with a type of data in order to use a packet protocol, and when nonpacket data has been received from the data processing apparatus, the nonpacket data is stored in the first area of the memory in order to use a nonpacket protocol.
According to one aspect, the present invention relates to a communication control apparatus for performing two-way communication processing with a data processing apparatus via a predetermined interface. The communication control apparatus includes storage means having a first area and a second area for storing data received from the data processing apparatus, and control means for storing, when packet data has been received from the data processing apparatus, the packet data in the first area or the second area in accordance with a type of data in order to use a packet protocol, and for storing, when nonpacket data has been received from the data processing apparatus, the nonpacket data in the first area in order to use a nonpacket protocol.
According to another aspect, the present invention relates to a communication control method in a communication control apparatus for performing two-way communication processing with a data processing apparatus via a predetermined interface. The communication control method includes the steps of storing, when packet data has been received from the data processing apparatus, the packet data in a first area or a second area of a memory in accordance with a type of data in order to use a packet protocol, and storing, when nonpacket data has been received from the data processing apparatus, the nonpacket data in the first area in order to use a nonpacket protocol.
According to still another aspect, the present invention relates to a storage medium storing a control program to be used in a communication control apparatus for performing two-way communication processing with a data processing apparatus via a predetermined interface. The storage medium includes a code of storing, when packet data has been received from the data processing apparatus, the packet data in a first area or a second area of a memory in accordance with a type of data in order to use a packet protocol, and a code of storing, when nonpacket data has been received from the data processing apparatus, the nonpacket data in the first area in order to use a nonpacket protocol.